package com.tarena.csmall.order.web.controller;

import cn.tedu.mall.common.restful.JsonResult;
import cn.tedu.mall.pojo.order.dto.OrderAddDTO;
import cn.tedu.mall.pojo.order.vo.OrderAddVO;
import com.tarena.csmall.order.web.service.OrderService;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.spring.web.json.Json;

@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;
    /**
     * 新增订单接口
     */
    @PostMapping("/oms/order/add")
    public JsonResult<OrderAddVO> orderAdd(OrderAddDTO orderAddDTO){
        //补齐一个订单SN
        orderAddDTO.setSn(UUID.randomUUID().toString());
        //调用业务层,实现订单新增
        OrderAddVO  orderAddVO=orderService.orderAdd(orderAddDTO);
        return JsonResult.ok(orderAddVO);
    }
}
